//===============================================================================
// Microsoft Architecture Strategy Team
// LitwareHR - SaaS Sample Application
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================


using System;
using Shp.Runtime.Sitka.ServiceAgent.EntityMappers;
using Shp.Runtime.Sitka.ServiceAgent.Managers;
using Shp.Runtime.Sitka.ServiceGateway.SitkaClient;

namespace Shp.Runtime.Sitka.ServiceAgent.Tests.Mocks
{
    class MockExtendedEntityMapper : EntityMapper<MockExtendedEntity>
    {
        public override MockExtendedEntity ToType(Entity flexibleEntity)
        {
            //Property tagProperty = flexibleEntity.Properties.Find(delegate(Property prop) { return prop.Name == "Tag"; });
            MockExtendedEntity myObject = new MockExtendedEntity(new Guid(flexibleEntity.Id), flexibleEntity.Properties["Tag"].ToString());
            return myObject;
        }

        public override Entity FromType(MockExtendedEntity entity)
        {
            Entity EntityMock = EntityManager.CreateEntity(this.Kind, entity.Id.ToString());
            EntityMock.Properties.Add("Tag", entity.Tag);
            return EntityMock;
        }
    }

}
